package com.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lmn on 2018/4/9.
 */
@RestController
@RequestMapping("redis")
public class RedisController {
    @Autowired
    private StringRedisTemplate redisTemplate;

    @RequestMapping("/demo")
    public void demo(){
        redisTemplate.opsForValue().set("demo-cache","diandian2u");
        System.out.println(redisTemplate.opsForValue().get("demo-cache"));
    }
}
